Why triangles? Three non-collinear points determine a unique plane, a unique circle, and the simplest polygon. Every polygon triangulates. Every smooth surface locally looks like a union of triangles. In computation, the triangle is the 2-simplex — the workhorse of graphics, FEM, and topology. This page traces the triangle from Book I of Euclid to simplicial homology, with live experiments.
1. Euclidean Geometry
In Euclid's Elements (c. 300 BCE), a triangle (trigonon) is the figure contained by three straight lines. The founding facts are deceptively powerful.
Definitions and classification
Given points A, B, C not on one line, the triangle ΔABC has sides a = BC opposite A, b = CA opposite B, c = AB opposite C, and interior angles A, B, C with A + B + C = π radians (180°). This angle sum is equivalent to Euclid's parallel postulate. Classification by sides: scalene (all different), isosceles (at least two equal — base angles equal), equilateral (all three equal, each angle 60°). By angles: acute (< 90° each), right (one = 90°), obtuse (> 90°).
The triangle inequality is sharp: a < b + c, with equality only for degenerate collinearity. It governs all metric spaces.
Congruence
Two triangles are congruent iff they coincide by rigid motion. Euclid gives four sufficient criteria, all still taught:
- SSS: Three sides determine shape uniquely. Proof via intersecting circles.
- SAS: Two sides and included angle. The hinge theorem follows.
- ASA and AAS: Two angles (thus three) and a side.
- HL: Hypotenuse-leg for right triangles (a special SAS).
SSA does not guarantee congruence — the ambiguous case in trigonometry.
Similarity
Scale invariance yields similarity: AA suffices, since angles fix shape. SAS-similarity and SSS-similarity are the scaled versions of congruence. Thales' theorem — a line parallel to BC cuts AB, AC proportionally — is the engine of similarity.
The four classical centers
Four lines concur in every (non-degenerate) triangle:
Centroid G — intersection of medians. Coordinates G = (A+B+C)/3. It is the center of mass of uniform lamina and of three equal point masses at vertices. Medians divide 2:1, vertex to centroid twice centroid to midpoint.
Incenter I — angle bisectors meet. I = (aA + bB + cC)/(a+b+c) in vector form, weighted by side lengths. It is equidistant from sides; the incircle touches each side at distance r, the inradius. r = Δ / s where Δ is area, s = (a+b+c)/2 semiperimeter.
Circumcenter O — perpendicular bisectors meet. O is center of unique circumcircle radius R = abc / (4Δ). For acute triangles O lies inside, for right at midpoint of hypotenuse, for obtuse outside.
Orthocenter H — altitudes concur. In vector form with O as origin, H = A + B + C; in general coordinates H = A + B + C − 2O. Reflections of H across sides lie on circumcircle.
Euler line and nine-point circle
Euler (1765) discovered O, G, H are collinear, with OG : GH = 1 : 2. Thus G = (O + 2H? careful) actually G divides OH in ratio 2:1 counting from vertex side: vector OG = (1/3) OH.
The nine-point circle (Feuerbach, 1822) passes through nine notable points: the three side midpoints Ma, Mb, Mc; the three feet of altitudes Ha, Hb, Hc; and the three midpoints of AH, BH, CH. Its center N is midpoint of OH, radius R/2. It is tangent to incircle and three excircles (Feuerbach theorem).
Ceva and Menelaus
Ceva's Theorem (1678): For points D on BC, E on CA, F on AB, lines AD, BE, CF concur iff (BD/DC)·(CE/EA)·(AF/FB) = 1 (signed ratios). Apply to medians (1·1·1), angle bisectors (by Angle Bisector Theorem), altitudes.
Menelaus' Theorem (c. 100 CE): For transversal cutting BC, CA, AB at D,E,F, D,E,F are collinear iff product = −1. Ceva and Menelaus are duals via projective geometry.
Together, these give the "genealogy" of triangle centers. Kimberling's Encyclopedia now lists over 50,000 defined centers, all as symmetric functions of side lengths.
2. Trigonometry — measuring the triangle
Trigonometry began as chord tables for astronomy. For a general triangle, two laws reduce all measurement to algebra.
Law of Sines
a / sin A = b / sin B = c / sin C = 2R. Proof: drop altitude h = b sin C = c sin B, or note that a = 2R sin A from the circumdiameter.
Consequence: SSA ambiguity. Given a, b, A, sin B = b sin A / a. If < 1, there may be 0, 1, or 2 solutions (B and 180°−B).
Law of Cosines
c² = a² + b² − 2ab cos C. It is Pythagoras with correction for projection. For C = 90°, recover c² = a² + b². The law yields SSS angle determination and SAS side determination.
The vector proof is immediate: c² = |A−B|² = |A|²+|B|²−2A·B.
Area formulas
All are equivalent, each revealing structure:
- Δ = ½ bc sin A = ½ ca sin B = ½ ab sin C
- Heron: Δ = √[s(s−a)(s−b)(s−c)]. Symmetric, requires only sides.
- Δ = rs (inradius)
- Δ = abc / (4R) (circumradius)
- Δ = 2R² sin A sin B sin C
Heron's proof via incircle tangents is a masterpiece of algebraic geometry.
Solving triangles
Classical cases: SSS, SAS, ASA/AAS have unique solutions; SSA is ambiguous. Use law of cosines for stability when angles near 0 or π. Mollweide's formulas (a+b)/c = cos½(A−B)/sin½C provide checks for computation before calculators.
3. Analytic and Barycentric Geometry
Descartes turns geometry into algebra.
With coordinates A(x₁,y₁), B(x₂,y₂), C(x₃,y₃):
- Area via determinant (shoelace): Δ = ½ |det [x₂−x₁ y₂−y₁; x₃−x₁ y₃−y₁]| = ½|x₁(y₂−y₃)+x₂(y₃−y₁)+x₃(y₁−y₂)|. Sign gives orientation.
- Circumcenter solves linear system from |X−A|²=|X−B|²=|X−C|².
- Line BC: (y₂−y₃)x + (x₃−x₂)y + (x₂y₃ − x₃y₂) = 0.
Barycentric coordinates
Introduced by Möbius (1827). Any point P in plane of non-collinear A,B,C writes uniquely as P = αA + βB + γC with α+β+γ=1. The triple (α,β,γ) is barycentric. If α,β,γ ≥0, P lies in triangle (convex combination).
Connection: α = area(PBC)/area(ABC), etc. Thus centroid = (1/3,1/3), incenter = (a,b,c)/(a+b+c), circumcenter = (sin2A, sin2B, sin2C).
Barycentrics linearize affine maps: images of triangle vertices determine whole map. In computer graphics, they give correct interpolation of color, texture, normals across triangles (perspective-correct after division by w).
4. Calculus on Triangles
Integration makes the triangle a fundamental domain.
Area via integral: Δ = ∫_{x₁}^{x₂} (y_top − y_bottom) dx, or via Green's theorem ∮ x dy = 2Δ. The shoelace formula is Green's in disguise.
Centroid of uniform lamina: x̄ = (1/Δ)∬_T x dA = (x₁+x₂+x₃)/3, and similarly ȳ. Derivation: integrate linear function over simplex — average of vertices.
Moments of inertia: I_x = ∬ y² dA = Δ/12 (y₁²+y₂²+y₃² + y₁y₂+y₂y₃+y₃y₁). Used in finite elements.
Linear interpolation: any affine function f over triangle is determined by vertex values fA,fB,fC, with f(P)=αfA+βfB+γfC. Its integral is Δ·(fA+fB+fC)/3 — the 1-point quadrature at centroid is exact for linear functions.
5. Spherical and Hyperbolic Triangles — Curvature
Euclid's parallel postulate fails on curved surfaces.
Spherical
On a sphere radius R, "lines" are great circles. A spherical triangle bounded by three great-circle arcs has side lengths a,b,c measured as central angles (0< a,b,c < πR). Its angles A,B,C are dihedral angles between planes.
Girard's theorem (1629): area = R²·E where E = A+B+C − π is spherical excess. Thus angle sum >180°, excess proportional to area. A triangle with three right angles (e.g., equator to north pole) has sum 270°, excess 90° = π/2, area = (π/2)R² = 1/8 of sphere.
Laws: spherical law of cosines cos(c/R) = cos(a/R)cos(b/R) + sin(a/R)sin(b/R)cos C. For small triangles, Taylor expansion recovers Euclidean law.
L'Huilier formula gives excess from sides: tan(E/4)=√[tan(s/2)tan((s−a)/2)tan((s−b)/2)tan((s−c)/2)].
Hyperbolic
In constant curvature −1, angle sum < π. Defect D = π − (A+B+C) >0, area = R²·D. Ideal triangles with vertices at infinity have area πR² finite despite infinite perimeter.
Hyperbolic law of cosines: cosh c = cosh a cosh b − sinh a sinh b cos C.
Gauss-Bonnet
For any geodesic triangle on smooth surface: ∬_T K dA + (sum exterior angles) = 2π. Since interior+exterior=π, this is ∬ K dA = A+B+C − π. On constant curvature K, area = (A+B+C − π)/K, unifying Euclidean (K=0), spherical (K>0), hyperbolic (K<0).
6. Linear Algebra — the Triangle as 2-Simplex
In ℝⁿ, points p₀,p₁,p₂ are affinely independent if vectors p₁−p₀, p₂−p₀ are linearly independent. Their convex hull is a 2-simplex.
Any point x = p₀ + J·ξ where J = [p₁−p₀ p₂−p₀] is 2×2 Jacobian, ξ=(u,v) with u,v≥0, u+v≤1. Area scales by |det J|. This is the map from reference triangle (0,0)-(1,0)-(0,1) to physical triangle.
In finite element method (FEM), linear basis functions φ₁=1−u−v, φ₂=u, φ₃=v satisfy φ_i(p_j)=δ_ij. Stiffness matrix entries ∫∇φ_i·∇φ_j dA depend only on geometry via J^{-T}J^{-1}·|det J|. Triangular meshes approximate arbitrary domains; refinement reduces error O(h²).
Barycentric coordinates are the coordinates in this simplex basis — central to convex optimization, barycentric subdivision, computer graphics rasterization.
7. Number Theory — integer triangles
Pythagorean triples
Integer solutions to a² + b² = c². Euclid's parametrization: for coprime m>n, opposite parity, primitive triple is a = m²−n², b=2mn, c=m²+n². All primitives arise thus. Non-primitives multiply by k. Properties: one leg even, area divisible by 6, product abc divisible by 60.
Heronian triangles
Triangles with integer sides and integer area. Smallest: 3-4-5 (area 6), 5-5-6 (12), 13-14-15 (84). Formula via Heron: Δ² = s(s−a)(s−b)(s−c) must be square. Parametric families exist using two Pythagorean triples glued along common leg. Almost-equilateral Heronian like 5-5-6 approach equilateral but perfect equilateral cannot be Heronian (area = √3/4 a² irrational unless a=0).
Rational triangles correspond to rational points on elliptic curves.
8. Topology — building spaces from triangles
A triangulation of a surface is a decomposition into triangles glued edge-to-edge. Simplicial complex requires intersections are faces.
Euler characteristic χ = V − E + F is invariant. For sphere, χ=2, implying any triangulation satisfies V−E+F=2. Since 3F=2E (each edge shared twice), get E=3V−6, F=2V−4 for sphere triangulations with no boundary — used in planar graph theory.
Torus has χ=0, so V−E+F=0, allowing 7-vertex triangulation (Császár torus). Classification of closed surfaces: χ = 2−2g for orientable genus g, χ = 2−k for nonorientable with k crosscaps.
Simplicial homology computes Betti numbers by linear algebra on boundary maps of simplices. Persistent homology uses filtrations of point clouds triangulated via Delaunay complexes.
Thus the triangle is atom of shape.
Interactive Explorations
Octave / MATLAB Examples
Copy-paste into Octave. No toolboxes required.
1. Classical centers from coordinates
%% triangle_centers.m A = [0 0]; B = [5 0]; C = [1.5 4]; a = norm(B-C); b = norm(C-A); c = norm(A-B); G = (A+B+C)/3 I = (a*A + b*B + c*C)/(a+b+c) D = 2*(A(1)*(B(2)-C(2)) + B(1)*(C(2)-A(2)) + C(1)*(A(2)-B(2))); Ux = ((A*A')*(B(2)-C(2)) + (B*B')*(C(2)-A(2)) + (C*C')*(A(2)-B(2))) / D; Uy = ((A*A')*(C(1)-B(1)) + (B*B')*(A(1)-C(1)) + (C*C')*(B(1)-A(1))) / D; O = [Ux Uy] H = A + B + C - 2*O N = (O+H)/2 % nine-point center R = norm(O-A)
2. Area by four formulas
%% area_formulas.m A=[0 0]; B=[4 0]; C=[1 3]; a=norm(B-C); b=norm(C-A); c=norm(A-B); s=(a+b+c)/2; % 1) cross product Delta1 = 0.5*abs(det([B-A; C-A])) % 2) SAS Cang = acos((a^2+b^2-c^2)/(2*a*b)); % at C? careful % use general: angle at A Aang = acos((b^2+c^2-a^2)/(2*b*c)); Delta2 = 0.5*b*c*sin(Aang) % 3) Heron Delta3 = sqrt(s*(s-a)*(s-b)*(s-c)) % 4) inradius r = Delta1/s; Delta4 = r*s
3. Solve SSS via law of cosines
%% law_of_cosines.m a=7; b=8; c=9; A = acosd((b^2+c^2-a^2)/(2*b*c)); B = acosd((a^2+c^2-b^2)/(2*a*c)); C = 180 - A - B; [A B C]
4. Generate primitive Heronian triangles
%% heronian_search.m
herons=[];
for a=1:30
for b=a:30
for c=b:30
if a+b>c
s=(a+b+c)/2; D=s*(s-a)*(s-b)*(s-c);
if D>0 && abs(sqrt(D)-round(sqrt(D)))<1e-9
herons=[herons; a b c sqrt(D)];
endif
endif
end
end
end
disp(herons(1:10,:))
5. Barycentric interpolation on reference triangle
%% barycentric.m % map (u,v) in reference to physical p0=[0 0]; p1=[5 1]; p2=[2 4]; J=[p1-p0; p2-p0]'; % 2x2 f0=10; f1=20; f2=30; % values at vertices [u,v]=meshgrid(0:0.05:1,0:0.05:1); mask=u+v<=1; pts = p0' + J*[u(mask)(:)' ; v(mask)(:)']; f = (1-u-v)*f0 + u*f1 + v*f2; scatter(pts(1,:),pts(2,:),20,f,'filled'); colorbar;
6. Spherical excess and Girard
%% spherical_excess.m
% unit sphere, points as unit vectors
A=[1 0 0]; B=[0 1 0]; C=[0 0 1];
A=A/norm(A); B=B/norm(B); C=C/norm(C);
a=acos(dot(B,C)); b=acos(dot(A,C)); c=acos(dot(A,B));
AngA=acos((cos(a)-cos(b)*cos(c))/(sin(b)*sin(c)));
AngB=acos((cos(b)-cos(a)*cos(c))/(sin(a)*sin(c)));
AngC=acos((cos(c)-cos(a)*cos(b))/(sin(a)*sin(b)));
E = AngA+AngB+AngC - pi;
area = E * 1^2; % R=1
printf('Angles deg: %.2f %.2f %.2f\n', AngA*180/pi, AngB*180/pi, AngC*180/pi);
printf('Excess %.4f rad, Area %.4f\n', E, area);